package com.bjb.vr.operation.controller;

import com.bjb.vr.common.ao.OptCusConfigAo;
import com.bjb.vr.common.result.BaseErrorCode;
import com.bjb.vr.common.result.BaseResult;
import com.bjb.vr.common.result.CommonResult;
import com.bjb.vr.common.service.OptCusConfigService;
import com.bjb.vr.common.service.SysTenantService;
import com.bjb.vr.common.vo.OptCusConfigVo;
import com.bjb.vr.common.vo.SysTenantVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @version 1.0.0
 * @description:客户配置管理-客户配置信息管理
 * @author: caihaibo
 * @createDate: 2022/6/16
 */
@RestController
@RequestMapping("/api/operation/v1")
public class CusConfigController {

    @Autowired
    OptCusConfigService optCusConfigService;



    @Autowired
    SysTenantService sysTenantService;

    /**
     * 客户配置管理-客户配置信息管理-客户配置信息详情
     * @param optCusConfigAo
     * @return
     */
    @PostMapping("/queryCusConfigDetail")
    public BaseResult<OptCusConfigVo> queryCusConfigDetail(@RequestBody OptCusConfigAo optCusConfigAo){

        return CommonResult.Ok().setResult(optCusConfigService.queryCusConfigDetail(optCusConfigAo));
    }

    /**
     * 客户配置管理-客户配置信息管理-增加客户配置
     * @param optCusConfigAo
     * @return
     */
    @PostMapping("/addOptCusConfig")
    public BaseResult addOptCusConfig(@RequestBody OptCusConfigAo optCusConfigAo){

        return  optCusConfigService.addOptCusConfig(optCusConfigAo);
    }

    /**
     * 客户配置管理-客户配置信息管理-修改客户配置
     * @param optCusConfigAo
     * @return
     */
    @PostMapping("/updateCusconfig")
    public BaseResult updateCusconfig(@RequestBody OptCusConfigAo optCusConfigAo){

        return optCusConfigService.updateCusConfig(optCusConfigAo);
    }


    /**
     * 客户配置管理-获取已设置基本信息租户树形列表
     * @return
     */
    @RequestMapping("/selectConfigSysTenantTree")
    public BaseResult<List<SysTenantVo>> selectConfigSysTenantTree(){
        List<SysTenantVo> sysTenantVoList = sysTenantService.selectConfigSysTenantTree();
        return CommonResult.Ok().setResult(sysTenantVoList);
    }

    /**
     * 客户配置管理-获取未设置基本信息租户树形列表
     * @return
     */
    @RequestMapping("/selectUnConfigSysTenantTree")
    public BaseResult<List<SysTenantVo>> selectUnConfigSysTenantTree(){
        List<SysTenantVo> sysTenantVoList = sysTenantService.selectUnConfigSysTenantTree();
        return CommonResult.Ok().setResult(sysTenantVoList);
    }
}
